package com.audition.thread.threadsecurity;

import java.util.HashMap;
import java.util.Map;

/**
 * @author xukang
 * @date 2021-03-08 16:12
 */
public class WrongInit {
    private Map<Integer, String> students;

    public WrongInit() {
        new Thread(new Runnable() {
            @Override
            public void run() {
                students = new HashMap<>();
                students.put(1, "小红");
                students.put(2, "小蓝");
                students.put(3, "小黑");
                students.put(4, "小绿");
                students.put(5, "小黄");
                students.put(6, "小紫");

            }
        }).start();
    }
    public Map<Integer, String> getStudents() {

        return students;
    }

    public static void main(String[] args) {
        WrongInit wrongInit = new WrongInit();
        System.out.println(wrongInit.getStudents().get(1));

    }
}
